#include<iostream>
using namespace std;
class A{
	public :
	    virtual void print_message()const{
		   cout<<"i am A"<<endl;
	   }
};
class B : virtual public A{
	public :
	   void print_message()const{
		   cout<<"i am B"<<endl;
	   }
};
class C : virtual public A{
	public :
	   void print_message()const{
		   cout<<"i am C"<<endl;
	   }
};

class D : public B,public C{
	public :
	   void print_message()const{
		   cout<<"i am D"<<endl;
	   }
};
int main(void){
	A *a_ptr = new A();
	A *b_ptr = new B();
	A *c_ptr = new C();
	A *d_ptr = new D();
	
	a_ptr->print_message();
	b_ptr->print_message();
	c_ptr->print_message();
	d_ptr->A::print_message();//强制A的版本
	return 0;
}